library(tidyverse)
library(kableExtra)
theme_set(theme_classic())
Outliers
df_outliers_control_group <- do.call(rbind, lapply(Sys.glob("../Control Group/Data/outliers/*.csv"), read_csv)) %>%
mutate(tournament = "control group")
df_outliers_complete_heterogeneity <- do.call(rbind, lapply(Sys.glob("../Complete Heterogeneity/Data/outliers/*.csv"), read_csv)) %>%
mutate(tournament = "complete heterogeneity")
df_outliers_chaning_SDM <- do.call(rbind, lapply(Sys.glob("../Changing SDM/Data/outliers/*.csv"), read_csv)) %>%
mutate(tournament = "changing SDM")
Combine outliers
outliers <- df_outliers_complete_heterogeneity %>%
rbind(df_outliers_control_group) %>%
rbind(df_outliers_chaning_SDM)
Cooperation rates
df_control_group <- do.call(cbind, lapply(Sys.glob("../Control Group/Data/*.csv"), read_csv)) %>%
janitor::clean_names() %>%
mutate(tournament = "control group",
round = row_number()) %>%
pivot_longer(seed_1024:seed_8, names_to = "Seed")
df_complete_heterogeneity <- do.call(cbind, lapply(Sys.glob("../Complete Heterogeneity/Data/*.csv"), read_csv)) %>%
janitor::clean_names() %>%
mutate(tournament = "complete heterogeneity",
round = row_number()) %>%
pivot_longer(seed_1024:seed_8, names_to = "Seed")
df_changing_SDM <- do.call(cbind, lapply(Sys.glob("../Changing SDM/Data/*.csv"), read_csv)) %>%
janitor::clean_names() %>%
mutate(tournament = "changing SDM",
round = row_number()) %>%
pivot_longer(seed_1024:seed_8, names_to = "Seed")
Combine cooperation rates
coop_rates <- df_control_group %>%
rbind(df_complete_heterogeneity) %>%
rbind(df_changing_SDM) %>%
mutate(Seed = str_remove(Seed, "seed_"))
Geom lines and geom points are not useful.
coop_rates %>%
mutate(seed = as.factor(Seed)) %>%
ggplot() +
geom_point(aes(round, value, color = seed)) +
facet_wrap(~tournament) +
labs(title = "Average cooperation ratio per seed per tournament type.",
x = "coop ratio",
y = "round") +
xlim(1000,9000)
coop_rates %>%
mutate(seed = as.factor(Seed)) %>%
ggplot() +
geom_line(aes(round, value, color = seed)) +
facet_wrap(~tournament) +
labs(title = "Average cooperation ratio per seed per tournament type.",
x = "coop ratio",
y = "round") +
xlim(1000,9000)
Smooth functions are useful.
coop_max <- coop_rates %>%
group_by(tournament) %>%
summarise(max_coop = max(value))
coop_rates %>%
mutate(seed = as.factor(Seed)) %>%
ggplot() +
geom_smooth(aes(round, value, color = seed), se = F) +
facet_wrap(~tournament) +
labs(title = "Average cooperation ratio per seed per tournament type.",
x = "coop ratio",
y = "round") +
xlim(1000,9000)
coop_rates %>%
mutate(seed = as.factor(Seed)) %>%
ggplot() +
geom_smooth(aes(round, value), color = "black") +
facet_wrap(~tournament) +
labs(title = "Average cooperation ratio per seed per tournament type.",
x = "coop ratio",
y = "round") +
xlim(1000,9000)
outliers %>%
mutate(seed = as.factor(Seed)) %>%
ggplot() +
geom_point(aes(S.D., Counts, color = seed)) +
geom_smooth(aes(S.D., Counts), color = "black") +
facet_wrap(~tournament) +
labs(title = "The instability of the average rage of cooperation.",
x = "s.d.",
y = "deviation from average")